<pre class='metadata'>
Title: AAC WebCodecs Registration
Repository: w3c/webcodecs
Status: NOTE-ED
Shortname: webcodecs-aac-codec-registration
Level: none
Group: mediawg
ED: https://w3c.github.io/webcodecs/aac_codec_registration.html
TR: https://www.w3.org/TR/webcodecs-aac-codec-registration/
Editor: Paul Adenot, w3cid 62410, Mozilla https://www.mozilla.org/
Editor: Eugene Zemtsov, w3cid 139375, Google LLC https://www.google.com/
Former Editor: Bernard Aboba, w3cid 65611, Microsoft Corporation https://www.microsoft.com/
Former Editor: Chris Cunningham, w3cid 114832, Google Inc. https://www.google.com/

Abstract: This registration is entered into the [[webcodecs-codec-registry]].
    It describes, for AAC, the (1) fully qualified [[WEBCODECS#config-codec-string|codec strings]], (2) the
    codec-specific {{EncodedAudioChunk}} {{EncodedAudioChunk/[[internal data]]}}
    bytes, (3) the {{AudioDecoderConfig/description|AudioDecoderConfig.description}}
    bytes, (4) the values of {{EncodedAudioChunk}} {{EncodedAudioChunk/[[type]]}},
    and (5) the codec-specific extensions to {{AudioEncoderConfig}}

    The registration is not intended to include any information on whether a
    codec format is encumbered by intellectual property claims. Implementers and
    authors are advised to seek appropriate legal counsel in this matter if they
    intend to implement or use a specific codec format. Implementers of
    WebCodecs are not required to support the AAC codec.

    This registration is non-normative.

Markup Shorthands:css no, markdown yes, dfn yes
!Participate: <a href="https://github.com/w3c/webcodecs">Git Repository.</a>
!Participate: <a href="https://github.com/w3c/webcodecs/issues/new">File an issue.</a>
!Version History: <a href="https://github.com/w3c/webcodecs/commits">https://github.com/w3c/webcodecs/commits</a>
</pre>

<pre class='biblio'>
{
  "iso14496-3": {
    "href": "https://www.iso.org/standard/53943.html",
    "title": "ISO/IEC 14496-3:2009 - Information technology — Coding of audio-visual objects — Part 3: Audio",
    "publisher": "ISO",
    "date": "2009-09"
  }
}
</pre>

Fully qualified codec strings {#fully-qualified-codec-strings}
==============================================================

This codec has multiple possible [[WEBCODECS#config-codec-string|codec strings]]:

- `"mp4a.40.2"` — MPEG-4 AAC LC
- `"mp4a.40.02"` — MPEG-4 AAC LC, leading 0 for Aud-OTI compatibility
- `"mp4a.40.5"` — MPEG-4 HE-AAC v1 (AAC LC + SBR)
- `"mp4a.40.05"` — MPEG-4 HE-AAC v1 (AAC LC + SBR), leading 0 for Aud-OTI compatibility
- `"mp4a.40.29"` — MPEG-4 HE-AAC v2 (AAC LC + SBR + PS)
- `"mp4a.67"` — MPEG-2 AAC LC

EncodedAudioChunk data {#encodedaudiochunk-data}
================================================

If the bitstream is in {{AacBitstreamFormat/adts}} format, the
{{EncodedAudioChunk/[[internal data]]}} of {{EncodedAudioChunk}}s are expected
to be an ADTS frame, as described in section 1.A.3.2 of [[iso14496-3]].

If the bitstream is in {{AacBitstreamFormat/aac}} format, the
{{EncodedAudioChunk/[[internal data]]}} of {{EncodedAudioChunk}}s are expected
to be a raw AAC frame (syntax element `raw_data_block()`), as described in
section 4.4.2.1 of [[iso14496-3]].

AudioDecoderConfig description {#audiodecoderconfig-description}
================================================================

If {{AudioDecoderConfig/description}} is present, it is assumed to a
`AudioSpecificConfig` as defined in [[iso14496-3]] section 1.6.2.1, Table 1.15,
and the bitstream is assumed to be in {{AacBitstreamFormat/aac}}.

If the {{AudioDecoderConfig/description}} is not present, the bitstream is
assumed to be in {{AacBitstreamFormat/adts}} format.

The {{AudioDecoderConfig/sampleRate}} and {{AudioDecoderConfig/numberOfChannels}}
members are ignored.

EncodedAudioChunk type {#encodedaudiochunk-type}
================================================

The {{EncodedAudioChunk/[[type]]}} for an {{EncodedAudioChunk}} containing
AAC is always "{{EncodedAudioChunkType/key}}".

NOTE: Once the initialization has succeeded, any AAC packet can be decoded at
    any time without error, but this might not result in the expected audio
    output.

    AudioEncoderConfig extensions {#audioencoderconfig-extensions}
    ==============================================================

    <pre class='idl'>
    <xmp>
    partial dictionary AudioEncoderConfig {
      AacEncoderConfig aac;
    };
    </xmp>
    </pre>

    <dl>
      <dt><dfn dict-member for=AudioEncoderConfig>aac</dfn></dt>
      <dd>
        Contains codec specific configuration options for the AAC codec.
      </dd>
    </dl>

    AacEncoderConfig {#aac-encoder-config}
    --------------------------------------

    <pre class='idl'>
    <xmp>
    dictionary AacEncoderConfig {
      AacBitstreamFormat format = "aac";
    };
    </xmp>
    </pre>

    <dl>
      <dt><dfn dict-member for=AacEncoderConfig>format</dfn></dt>
      <dd>
        Configures the format of output {{EncodedAudioChunk}}s. See
        {{AacBitstreamFormat}}.
      </dd>
    </dl>

    AacBitstreamFormat {#aac-bitstream-format}
    ------------------------------------------
    <pre class='idl'>
    <xmp>
    enum AacBitstreamFormat {
      "aac",
      "adts",
    };
    </xmp>
    </pre>

    The {{AacBitstreamFormat}} determines the location of the metadata necessary to decode the encoded audio stream.

    <dl>
      <dt><dfn enum-value for=AacBitstreamFormat>aac</dfn></dt>
      <dd>
        The metadata of the encoded audio stream are provided at configuration via
        {{AudioDecoderConfig/description|AudioDecoderConfig.description}}.
      </dd>
      <dt><dfn enum-value for=AacBitstreamFormat>adts</dfn></dt>
      <dd>
        The metadata of the encoded audio stream are provided in each ADTS frame,
        and therefore no {{AudioDecoderConfig/description|AudioDecoderConfig.description}} is necessary.
    </dl>

Privacy Considerations {#privacy-considerations}
==========================================================================

Please refer to the section [[WEBCODECS#privacy-considerations|Privacy
Considerations]] in [[WEBCODECS]].

Security Considerations {#security-considerations}
==========================================================================

Please refer to the section [[WEBCODECS#security-considerations|Security
Considerations]] in [[WEBCODECS]].
